<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>arguments</title>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
    </ul>
</body>
<script>
    let list = document.querySelectorAll("li");
    console.log(list);


//    Object ===> 基类
//    arguments 参数集合  伪数组
    function func() {
        console.log("arguments---->",arguments);

        let arr = [1,2,3];
//        arr[4] = 4;


        console.log("typeof--1-->",typeof arguments);
        console.log("typeof--2-->",typeof arr);

        console.log("instanceof--1-->",arguments instanceof Array);
        console.log("instanceof--2-->",arr instanceof Array);


//        arguments    性能(内存占用 运算的复杂度)
//        let arg =  [].slice.call(arguments); //1
        let arg =  Array.prototype.slice.call(arguments); //2
        console.log("arg",arg instanceof Array);
        arg.map((item)=>{
            console.log(item);  //1,2,3,4
        });

        let arg2 = [...arguments];
        console.log("arg2--2-->",arg2 instanceof Array);


    }
    func(1,2,3,4);

    let func2 = (...arg)=>{

        console.log("func2-->",arg);
    };
    func2(1,2,3,4);

</script>
</html>